\(\int \frac {2 a x-x^2}{a^3+x^3} \, dx\) [365]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [C] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 20, antiderivative size = 29 \[ \int \frac {2 a x-x^2}{a^3+x^3} \, dx=-\frac {2 \arctan \left (\frac {a-2 x}{\sqrt {3} a}\right )}{\sqrt {3}}-\log (a+x) \]

[Out]

-ln(a+x)-2/3*arctan(1/3*(a-2*x)/a*3^(1/2))*3^(1/2)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {1607, 1882, 31, 631, 210} \[ \int \frac {2 a x-x^2}{a^3+x^3} \, dx=-\frac {2 \arctan \left (\frac {a-2 x}{\sqrt {3} a}\right )}{\sqrt {3}}-\log (a+x) \]

[In]

Int[(2*a*x - x^2)/(a^3 + x^3),x]

[Out]

(-2*ArcTan[(a - 2*x)/(Sqrt[3]*a)])/Sqrt[3] - Log[a + x]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 210

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^(-1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])
], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 631

Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = 1 - 4*Simplify[a*(c/b^2)]}, Dist[-2/b, Sub
st[Int[1/(q - x^2), x], x, 1 + 2*c*(x/b)], x] /; RationalQ[q] && (EqQ[q^2, 1] ||  !RationalQ[b^2 - 4*a*c])] /;
 FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 1607

Int[(u_.)*((a_.)*(x_)^(p_.) + (b_.)*(x_)^(q_.))^(n_.), x_Symbol] :> Int[u*x^(n*p)*(a + b*x^(q - p))^n, x] /; F
reeQ[{a, b, p, q}, x] && IntegerQ[n] && PosQ[q - p]

Rule 1882

Int[(P2_)/((a_) + (b_.)*(x_)^3), x_Symbol] :> With[{A = Coeff[P2, x, 0], B = Coeff[P2, x, 1], C = Coeff[P2, x,
 2]}, With[{q = Rt[a/b, 3]}, Dist[C/b, Int[1/(q + x), x], x] + Dist[(B + C*q)/b, Int[1/(q^2 - q*x + x^2), x],
x]] /; EqQ[A - Rt[a/b, 3]*B - 2*Rt[a/b, 3]^2*C, 0]] /; FreeQ[{a, b}, x] && PolyQ[P2, x, 2]

Rubi steps \begin{align*} \text {integral}& = \int \frac {(2 a-x) x}{a^3+x^3} \, dx \\ & = a \int \frac {1}{a^2-a x+x^2} \, dx-\int \frac {1}{a+x} \, dx \\ & = -\log (a+x)+2 \text {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,1-\frac {2 x}{a}\right ) \\ & = -\frac {2 \tan ^{-1}\left (\frac {a-2 x}{\sqrt {3} a}\right )}{\sqrt {3}}-\log (a+x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.97 \[ \int \frac {2 a x-x^2}{a^3+x^3} \, dx=\frac {1}{3} \left (2 \sqrt {3} \arctan \left (\frac {-a+2 x}{\sqrt {3} a}\right )-2 \log (a+x)+\log \left (a^2-a x+x^2\right )-\log \left (a^3+x^3\right )\right ) \]

[In]

Integrate[(2*a*x - x^2)/(a^3 + x^3),x]

[Out]

(2*Sqrt[3]*ArcTan[(-a + 2*x)/(Sqrt[3]*a)] - 2*Log[a + x] + Log[a^2 - a*x + x^2] - Log[a^3 + x^3])/3

Maple [A] (verified)

Time = 1.53 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.00

method result size
default \(\frac {2 \sqrt {3}\, \arctan \left (\frac {\left (-a +2 x \right ) \sqrt {3}}{3 a}\right )}{3}-\ln \left (a +x \right )\) \(29\)
risch \(\frac {2 \sqrt {3}\, \arctan \left (\frac {\left (-a +2 x \right ) \sqrt {3}}{3 a}\right )}{3}-\ln \left (a +x \right )\) \(29\)

[In]

int((2*a*x-x^2)/(a^3+x^3),x,method=_RETURNVERBOSE)

[Out]

2/3*3^(1/2)*arctan(1/3*(-a+2*x)*3^(1/2)/a)-ln(a+x)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 26, normalized size of antiderivative = 0.90 \[ \int \frac {2 a x-x^2}{a^3+x^3} \, dx=\frac {2}{3} \, \sqrt {3} \arctan \left (-\frac {\sqrt {3} {\left (a - 2 \, x\right )}}{3 \, a}\right ) - \log \left (a + x\right ) \]

[In]

integrate((2*a*x-x^2)/(a^3+x^3),x, algorithm="fricas")

[Out]

2/3*sqrt(3)*arctan(-1/3*sqrt(3)*(a - 2*x)/a) - log(a + x)

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.07 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.86 \[ \int \frac {2 a x-x^2}{a^3+x^3} \, dx=- \log {\left (a + x \right )} - \frac {\sqrt {3} i \log {\left (- \frac {a}{2} - \frac {\sqrt {3} i a}{2} + x \right )}}{3} + \frac {\sqrt {3} i \log {\left (- \frac {a}{2} + \frac {\sqrt {3} i a}{2} + x \right )}}{3} \]

[In]

integrate((2*a*x-x**2)/(a**3+x**3),x)

[Out]

-log(a + x) - sqrt(3)*I*log(-a/2 - sqrt(3)*I*a/2 + x)/3 + sqrt(3)*I*log(-a/2 + sqrt(3)*I*a/2 + x)/3

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 26, normalized size of antiderivative = 0.90 \[ \int \frac {2 a x-x^2}{a^3+x^3} \, dx=\frac {2}{3} \, \sqrt {3} \arctan \left (-\frac {\sqrt {3} {\left (a - 2 \, x\right )}}{3 \, a}\right ) - \log \left (a + x\right ) \]

[In]

integrate((2*a*x-x^2)/(a^3+x^3),x, algorithm="maxima")

[Out]

2/3*sqrt(3)*arctan(-1/3*sqrt(3)*(a - 2*x)/a) - log(a + x)

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.93 \[ \int \frac {2 a x-x^2}{a^3+x^3} \, dx=\frac {2}{3} \, \sqrt {3} \arctan \left (-\frac {\sqrt {3} {\left (a - 2 \, x\right )}}{3 \, a}\right ) - \log \left ({\left | a + x \right |}\right ) \]

[In]

integrate((2*a*x-x^2)/(a^3+x^3),x, algorithm="giac")

[Out]

2/3*sqrt(3)*arctan(-1/3*sqrt(3)*(a - 2*x)/a) - log(abs(a + x))

Mupad [B] (verification not implemented)

Time = 11.52 (sec) , antiderivative size = 26, normalized size of antiderivative = 0.90 \[ \int \frac {2 a x-x^2}{a^3+x^3} \, dx=-\ln \left (a+x\right )-\frac {2\,\sqrt {3}\,\mathrm {atan}\left (-\frac {\sqrt {3}\,a}{a-2\,x}\right )}{3} \]

[In]

int((2*a*x - x^2)/(a^3 + x^3),x)

[Out]

- log(a + x) - (2*3^(1/2)*atan(-(3^(1/2)*a)/(a - 2*x)))/3